3 // SCImage animation example - from a code of Tom Tlalim, adapted for SCImage by blackrain
5 var w, h = 800, v = 600, seed = Date.seed, phase=0, phasef = 0.00125, zoom = 1, zoomf = 1.01, trans=0.1, run = true, i=0, amess, ind=0;
6 var size = 100, mess, ordered;
9 export=false; // <--- toggle to export frames
11 w = Window("animation", Rect(40, 40, h, v));
13 w.view.background_(Color.white);
14 u = UserView.new(w, Rect(0, 0, h, v));
18 image = SCImage.new(h@v);
21 Pen.fillRect(Rect(0,0,h,v));
24 mess = [{1.0.rand2}!200, {1.0.rand2}!200, {1.0.rand2}!200];
29 image.drawAtPoint(0@0);
44 Pen.color = Color.black.alpha_(0.1);
45 Pen.fillRect(Rect(0,0,h, v));
46 Pen.strokeColor = Color.grey(1,0.7);
47 (mess[0].size * (zoom*0.1).min(1)).do {
49 #x, y, z = [amess[0][i], amess[1][i], amess[2][i]];
54 (y.neg)*100 + (z*0.5 +1)*(zoom/5),
55 (y.neg)*100 + (z*0.5+1)*(zoom/5)
58 i=(i+1)%((mess[0].size));
63 i = (mess[0].size/(zoom));
70 image.write(Document.current.path.dirname ++ "/SavedImage_"++ind++".jpeg");
73 //}.bench; // bench to tune it
89 }.defer(0.3); // enough to release safely